<template>
    <div class="deposit-content">
        <div class="deposit-title">
            <img src="../../assets/img/back.png" alt="" @click="backRoute()">
            定存TRX
            <div class="record" @click="changeRoute('/deposit-record')">定存记录</div>
        </div>
        <div class="deposit-list">
            <div class="deposit-item">
                <span class="deposit-mes">转入30天，预期收益日1.5%</span>
                <div class="van-switch">
                    <input type="checkbox" name="sex" id="male1" class="chooseBtn" :checked="isCheck1" @click="isCheck1 = !isCheck1, isCheck2 = false, isCheck3 = false"/>
                    <label for="male1" class="choose-label"></label>
                </div>
            </div>
            <div class="deposit-item">
                <span class="deposit-mes">转入90天，预期收益日2%</span>
                <div class="van-switch">
                    <input type="checkbox" name="sex" id="male2" class="chooseBtn" :checked="isCheck2" @click="isCheck2 = !isCheck2, isCheck1 = false, isCheck3 = false"/>
                    <label for="male2" class="choose-label"></label>
                </div>
            </div>
            <div class="deposit-item">
                <span class="deposit-mes">转入180天，预期收益日2.5%</span>
                <div class="van-switch">
                    <input type="checkbox" name="sex" id="male3" class="chooseBtn" :checked="isCheck3" @click="isCheck3 = !isCheck3, isCheck2 = false, isCheck1 = false"/>
                    <label for="male3" class="choose-label"></label>
                </div>
            </div>
        </div>
        <div class="deposit-submit">
            <div class="terms">
                <i class="check-box" :class="showCheck ? 'checked' : ''" @click="showCheck = !showCheck"></i>
                <span>我已阅读并同意 </span>
                <span class="terms-link" @click="changeRoute('/agreement')">《波点钱包服务协议》</span>
            </div>
            <span class="deposit-submit-btn" @click="showAlert = isCheck1 | isCheck2 | isCheck3">定存</span>
        </div>
        <div class="dialog deposit-dialog van-popup" v-if="showAlert">
            <div class="close" @click="showAlert = false"></div>
            <h3 class="dlg-title">定存30天</h3>
            <div class="demo-ruleForm wrap">
                <label>
                    <span class="labelTit">定存数量：</span>
                    <input type="number" placeholder="请输入定存数量">
                    <div class="tip">您的TRX余额为0</div>
                </label>
                <div class="btn-line">
                    <button class="btn" @click="showAlert = false">确定</button>
                </div>
            </div>
        </div>
        <div class="van-overlay" v-if="showAlert"></div>
    </div>
</template>

<script>
    export default {
        name: 'deposit',
        data() {
            return {
                showCheck: true,
                showAlert: false,
                isCheck1: false,
                isCheck2: false,
                isCheck3: false
            }
        }
    }
</script>

<style lang="scss">
    .deposit-content {
        width: 100%;
        height: 100%;
        background-color: rgb(247, 247, 247);
        .deposit-title {
            width: 100%;
            height: 1rem;
            line-height: 1rem;
            text-align: center;
            font-size: 0.34rem;
            border-bottom: 0.02rem solid #ccc;
            background-color: #fefefe;
            position: relative;
            img {
                width: 0.36rem;
                position: absolute;
                left: 0.2rem;
                top: 0.32rem;
            }
            .record{
                font-size: 0.28rem;
                position: absolute;
                right: 0.2rem;
                top: 0;
            }
        }
        .deposit-list{
            margin-top: 0.1rem;
            background: #fff;
            .deposit-item {
                height: 0.96rem;
                line-height: 0.96rem;
                font-family: PingFangSC-Regular,serif;
                font-size: 0.32rem;
                color: #333;
                letter-spacing: 0;
                padding: 0 0.24rem 0 0.3rem;
                box-shadow: inset 0 -0.02rem 0 0 #ddd;
                border-radius: 0.02rem;
                .van-switch{
                    float: right;
                    display: inline-block;
                }
                .chooseBtn {
                    display: none;
                }

                .choose-label {
                    box-shadow: #ccc 0 0 0 1px;
                    width: 40px;
                    height: 20px;
                    display: inline-block;
                    border-radius: 20px;
                    position: relative;
                    background-color: #bdbdbd;
                    overflow: hidden;
                    vertical-align: top;
                    margin-top: 14px;
                }

                .choose-label:before {
                    content: '';
                    position: absolute;
                    left: 0;
                    width: 20px;
                    height: 20px;
                    display: inline-block;
                    border-radius: 20px;
                    background-color: #fff;
                    z-index: 20;
                    -webkit-transition: all 0.5s;
                    transition: all 0.5s;
                }

                .chooseBtn:checked + label.choose-label:before {
                    left: 20px;
                }

                .chooseBtn:checked + label.choose-label {
                    background-color: #3DCC6E;
                }
            }
        }
        .deposit-submit{
            margin: 0.54rem auto 0.56rem;
            width: 100%;
            text-align: center;
            .terms{
                -webkit-user-select: none;
                cursor: pointer;
                margin: 0.2rem auto;
                font-size: 0.24rem;
                .check-box{
                    background-image: linear-gradient(0deg,#d9d9d9,#fff);
                    border: 1px solid #dadada;
                    border-radius: .10667rem;
                    display: inline-block;
                    width: 0.32rem;
                    height: 0.32rem;
                    vertical-align: bottom;
                    margin-bottom: 0.02rem;
                    box-sizing: border-box;
                }
                .checked{
                    border: 0;
                    background: url(../../assets/img/check.png);
                    background-size: contain;
                }
                .terms-link{
                    color: #2ab3ce;
                    cursor: pointer;
                }
            }
            .terms:active{
                -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            }
            .deposit-submit-btn{
                display: inline-block;
                width: 4.56rem;
                height: 0.88rem;
                line-height: 0.88rem;
                background: #e60816;
                border-radius: 0.44rem;
                font-family: PingFangSC-Medium,serif;
                font-size: 0.36rem;
                color: #fff;
                letter-spacing: 0;
                cursor: pointer;
                vertical-align: top;
            }
            .deposit-submit-btn:active{
                -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            }
        }
        .van-overlay{
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,.7);
            z-index: 2001;
        }
        .dialog{
            width: 80%;
            height: 4.2rem;
            background-color: #fff;
            border-radius: 0.1rem;
            min-height: 3rem;
            overflow: auto;
            padding: 0.3rem 0.5rem;
            z-index: 2002;
            .close{
                position: absolute;
                width: 0.32rem;
                height: 0.32rem;
                background: url(../../assets/img/guanbi.png) 0 0 no-repeat;
                background-size: 100%;
                top: 0.24rem;
                right: 0.24rem;
            }
            .dlg-title{
                font-size: 0.36rem;
                color: #1d1d1d;
                text-align: center;
                width: 100%;
                margin: 0.1rem 0 0.25rem;
                padding-top: 0.3rem;
                font-family: PingFangSC-Regular,serif;
                font-weight: 400;
            }
            .demo-ruleForm{
                label{
                    display: block;
                    position: relative;
                    height: 1.16rem;
                    .labelTit{
                        font-size: 0.28rem;
                        color: #1d1d1d;
                        line-height: 0.5rem;
                        position: absolute;
                        top: 4px;
                    }
                    input{
                        background: #fff;
                        border: 1px solid #e7e7e7;
                        box-shadow: 0 2px 4px 0 hsla(0,0%,74%,.5);
                        border-radius: 0.5rem;
                        width: 60%;
                        height: 0.64rem;
                        padding-left: 0.2rem;
                        -webkit-appearance: none;
                        outline: 0;
                        position: absolute;
                        top: 0;
                        left: 70px;
                    }
                    .tip{
                        color: #666;
                        margin: 0.2rem 0.3rem 0 0;
                        font-size: 0.24rem;
                        text-align: left;
                        position: absolute;
                        top: 30px;
                    }
                }
                .btn-line{
                    margin-top: 0.4rem;
                    text-align: center;
                    height: 0.6rem;
                    .btn{
                        background-color: #e60816;
                        height: 0.6rem;
                        line-height: 0.6rem;
                        border-radius: 0.5rem;
                        border: none;
                        padding: 0;
                        width: 2.4rem;
                        user-select: none;
                        color: #fff;
                        font-size: 0.26rem;
                        vertical-align: top;
                    }
                }
            }
        }
        .van-popup{
            position: fixed;
            top: 50%;
            left: 50%;
            max-height: 100%;
            transition: 0.3s ease-out;
            transform: translate3d(-50%,-50%,0);
        }
    }
</style>
